﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows;

namespace PasswordProvider.View.Behaviors
{
    internal static class EventCommands
    {
        #region Drop Command (re-routes DropEvent)

        /// <summary>
        /// Hooks up the MouseDoubleClick event of any FrameworkElement derived object
        /// to a bound ICommand using Samual Jacks EventBehaviorFactory
        /// </summary>
        public static readonly DependencyProperty DropCommand =
            EventCommandBehaviourFactory.CreateCommandExecutionEventBehaviour(
                FrameworkElement.DropEvent, "DropCommand", typeof(EventCommands));

        public static void SetDropCommand(DependencyObject element, ICommand value)
        {
            element.SetValue(DropCommand, value);
        }
        public static ICommand GetDropCommand(DependencyObject element)
        {
            return (ICommand)element.GetValue(DropCommand);
        }
        #endregion // Drop command

        #region DragEnter

        /// <summary>
        /// Hooks up the DradEnter event of any FrameworkElement derived object
        /// to a bound ICommand using Samual Jacks EventBehaviorFactory
        /// </summary>
        public static readonly DependencyProperty DragEnterCommand =
            EventCommandBehaviourFactory.CreateCommandExecutionEventBehaviour(
                FrameworkElement.DragEnterEvent, "DragEnterCommand", typeof(EventCommands));

        public static void SetDragEnterCommand(DependencyObject element, ICommand value)
        {
            element.SetValue(DragEnterCommand, value);
        }
        public static ICommand GetDragEnterCommand(DependencyObject element)
        {
            return (ICommand)element.GetValue(DragEnterCommand);
        }

        #endregion // DragEnter

        #region DragOver

        /// <summary>
        /// Hooks up the DradEnter event of any FrameworkElement derived object
        /// to a bound ICommand using Samual Jacks EventBehaviorFactory
        /// </summary>
        public static readonly DependencyProperty DragOverCommand =
            EventCommandBehaviourFactory.CreateCommandExecutionEventBehaviour(
                FrameworkElement.DragOverEvent, "DragOverCommand", typeof(EventCommands));

        public static void SetDragOverCommand(DependencyObject element, ICommand value)
        {
            element.SetValue(DragOverCommand, value);
        }
        public static ICommand GetDragOverCommand(DependencyObject element)
        {
            return (ICommand)element.GetValue(DragOverCommand);
        }

        #endregion // DragOver

        #region PreviewMouseDown

        /// <summary>
        /// Hooks up the PreviewMouseDown event of any FrameworkElement derived object
        /// to a bound ICommand using Samual Jacks EventBehaviorFactory        
        /// </summary>
        public static readonly DependencyProperty PreviewMouseDownCommand =
            EventCommandBehaviourFactory.CreateCommandExecutionEventBehaviour(
                FrameworkElement.PreviewMouseDownEvent, "PreviewMouseDownCommand", typeof(EventCommands));

        public static void SetPreviewMouseDownCommand(DependencyObject element, ICommand value)
        {
            element.SetValue(PreviewMouseDownCommand, value);
        }
        public static ICommand GetPreviewMouseDownCommand(DependencyObject element)
        {
            return (ICommand)element.GetValue(PreviewMouseDownCommand);
        }

        #endregion // MouseDown

        #region MouseDoubleClick
        /// <summary>
        /// Hooks up the MouseDoubleClick event of any Control derived object
        /// to a bound ICommand using Samual Jacks EventBehaviorFactory        
        /// </summary>
        public static readonly DependencyProperty MouseDoubleClickCommand =
            EventCommandBehaviourFactory.CreateCommandExecutionEventBehaviour(
                Control.MouseDoubleClickEvent, "MouseDoubleClickCommand", typeof(EventCommands));

        public static void SetMouseDoubleClickCommand(DependencyObject element, ICommand value)
        {
            element.SetValue(MouseDoubleClickCommand, value);
        }
        public static ICommand GetMouseDoubleClickCommand(DependencyObject element)
        {
            return (ICommand)element.GetValue(MouseDoubleClickCommand);
        }
        #endregion // MouseDoubleClick
    }

}
